import { AxiosResponse } from '@ohos/axios'
import $api from './request'
interface  SendParams {
  phone: string
}
interface  SuccessRes {

    token: string

}
export  interface sendCodeResponse {
  data: SuccessRes,
  success: boolean
}
export const sendCode = (phone:string)=>{
     return $api.post<string, AxiosResponse<sendCodeResponse>, SendParams>('/sendCode',{phone})
}

interface LoginParams {
  phone: string,
  code: string
}

export const login = (data:LoginParams)=>{
  return $api.post<string, AxiosResponse<sendCodeResponse>, LoginParams>('/user/login',data)
}